package com.avic.rong.richEditor.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.avic.rong.R;

/**
 * Creater: Created by wangyz on 2019/9/24.
 * Email: 936804097@qq.com
 */
public class PublishTipDialog extends Dialog implements View.OnClickListener {


    private Context context;
    private String hintMessage;
    private TextView tv_hint_message;


    public PublishTipDialog(Context context,String hintMessage) {

        //使用自定义Dialog样式
        super(context, R.style.Theme_dialog);

        this.context = context;
        this.hintMessage=hintMessage;
        //指定布局
        setContentView(R.layout.publish_tip_dialog);

        tv_hint_message = findViewById(R.id.tv_hint_message);
        findViewById(R.id.bt_cancel).setOnClickListener(this);
        findViewById(R.id.img_close).setOnClickListener(this);

        tv_hint_message.setText(hintMessage+"");


        //点击外部不可消失
        setCancelable(true);
    }


    @Override
    public void onClick(View v) {
        int viewId = v.getId();
        switch (viewId) {
            case R.id.bt_cancel:
            case R.id.img_close:
                if (callBackInterface != null){
                    callBackInterface.cannel();
                }
                dismiss();
                break;
        }
    }

    private  CallBackInterface callBackInterface;

    public void setCallBackInterface(CallBackInterface callBackInterface) {
        this.callBackInterface = callBackInterface;
    }

    public interface CallBackInterface{
        void cannel();
    }


}